package edu.hawaii.duedates;

/**
 * The User Class implements the IUser interface.  A user is comprised of a name, password,
 * and validity of the user.
 * 
 * @author Ronn Reeves and Robin E. Raqueno
 */
public class User implements IUser {
  
  /** The user's id.*/
  private String userID;
  /** The user's password.*/
  private String password;
  /**The user's validity.*/
  private boolean validity;
  
  
  /**
   * Creates a user object with the given user id, password, and a default validity of false.
   * 
   * @param userID  The user's id.
   * @param password  The user's password.
   */
  public User(String userID, String password) {
    this.userID = userID;
    this.password = password;
    this.validity = false;
  }
  
  
  /**
   * Sets this user's ID.
   *
   * @param userID The user id.
   */
  public void setUserID(String userID) {
    this.userID = userID;
  }
  /**
   * Returns this user's id.
   * 
   * @return String The user id.
   */
  public String getUserID() {
    return this.userID;
  }
  

  /**
   * Sets this user's password.
   *
   * @param password The user's password.
   */
  public void setPassword(String password) {
   this.password = password; 
  }
  /**
   * Returns this user's password.
   * 
   * @return String The user's password.
   */
  public String getPassword() {
    return this.password;
  }

  
  /**
   * Sets the validity of this user.
   * 
   * @param validity  The validity status of this user.
   */
  public void setValid(boolean validity) {
    this.validity = validity;
    
  }
  /**
   * Returns true if the user is valid.
   *
   * @return Boolean The validity of the user.
   */
  public boolean isValid() {
    return this.validity;
  }

  
  /**
   * Returns the user id.
   *
   * @return String The user id.
   */
  public String toString() {
    return this.getUserID();
  }
}
